<template>
  <div>
    <ul>
      <li v-for="item in arr" :key="item.id">
        {{ item.name }} <input type="text" name="" id="" />
      </li>
    </ul>
    <button @click="add">添加一个</button>
  </div>
</template>

<script>
export default {
  name: 'Vueday03App',

  data() {
    return {
      arr: [
        { id: '001', name: '老王' },
        { id: '002', name: '老李' },
        { id: '003', name: '张三' }
      ]
    }
  },

  mounted() {},

  methods: {
    add() {
      this.arr.splice(2, 0, { id: '', name: '隔壁老王' })
    }
  }
}
</script>

<style lang="scss" scoped></style>
